#ifndef NctiWindowView_H
#define NctiWindowView_H
#include "NctiWindowObject.h"
#include "ncti.h"
#include "NctiRenderKeyboardEvent.h"
namespace NCTI
{
	class NctiBaseView;
	class NctiWindowViewManager;
	/**
	* @brief the window view, display render data
	* @see NctiWindowObject
	*/
	class DECL_NCTI_WINDOW NctiWindowView : public NctiWindowObject
	{
	public:
		NctiWindowView(NctiWindowViewManager* i_pParent = nullptr, 
            EnumRenderModelType i_RenderModelType = NCTI_RENDER_VULKAN,
            Ncti_Integer i_wid = 300,Ncti_Integer i_high = 300);
		virtual ~NctiWindowView();

		/**
	   * @brief Initialization during obj class creation by NctiBaseView
	   * @param[in] i_pBaseView, the base view 
	   */
		void InitRender(NctiBaseView* i_pBaseView);
		/**
	   * @brief get render view
	   * @return NctiViewerRenderer*
	   */
		NCTI::NctiViewerRenderer* getCanvas();
		/**
	   * @brief get base view
	   * @return NctiBaseView*
	   */
		NctiBaseView* GetBaseView();
		/**
	   * @brief implement the resize function event
	   * @param[in] i_event, NctiWindowResizeEvent
	   */
        void resizeEvent(NctiWindowResizeEvent* i_event) override;
		/**
	   * @brief implement key press function event
	   * @param[in] i_event, NctiWindowKeyEvent
	   */
        void keyPressEvent(NctiWindowKeyEvent* i_event) override;
		/**
	   * @brief implement key release function event
	   * @param[in] i_event, NctiWindowKeyEvent
	   */
        void keyReleaseEvent(NctiWindowKeyEvent* i_event) override;
		/**
	   * @brief implement mouse press function event
	   * @param[in] i_event, NctiWindowMouseEvent
	   */
        void mousePressEvent(NctiWindowMouseEvent* i_event) override;
		/**
	   * @brief implement mouse release function event
	   * @param[in] i_event, NctiWindowMouseEvent
	   */
        void mouseReleaseEvent(NctiWindowMouseEvent* i_event) override;
		/**
	   * @brief implement mouse move function event
	   * @param[in] i_event, NctiWindowMouseEvent
	   */
        void mouseMoveEvent(NctiWindowMouseEvent* i_event) override;
		/**
	   * @brief implement mouse double click function event
	   * @param[in] i_enter, NctiWindowMouseEvent
	   */
        void mouseDoubleClickEvent(NctiWindowMouseEvent* i_event) override;
		/**
	   * @brief implement wheel function event
	   * @param[in] i_enter, NctiWindowWheelEvent
	   */
        void wheelEvent(NctiWindowWheelEvent* i_event) override;
		/**
	   * @brief implement enter leave function event
	   * @param[in] i_enter
	   */
        void enterLeaveEvent(bool enter)override;
	private:
		/**
		* @brief internal used
		*/
		void buildMouseEvent(
			NctiWindowMouseEvent* i_event,
			NctiRenderMouseEvent::Action i_action,
			Ncti_UInteger i_click_count);
		/**
		* @brief internal used
		*/
		void buildKeyboardEvent(
			NctiWindowKeyEvent* i_event,
			NctiRenderKeyboardEvent::Action i_action);
	protected:
		Ncti_Boolean m_Right;
		Ncti_Boolean m_RightMove;
		NctiPosition m_PressPos;
    private:
        NctiBaseView* m_BaseView{nullptr};
        NctiWindowViewManager* m_mgr{nullptr};
        NctiViewerRenderer* m_RenderCanvas{ nullptr };
        EnumRenderModelType m_RenderModelType;
	};
}
#endif
